# -*- coding: utf-8 -*-
from locust import HttpUser, task, between
from locust import events
from locust import task, between
import os
import webbrowser
headers = {"Content-Type": "application/json", 'Authorization': 'cd84871212a24ed3b6051752890491a1'}


class WebsiteUser(HttpUser):
    wait_time = between(5, 15)

    @task
    def getValidByCode(self):
        getValidByCode_url = "/operationActivity/getValidByCode?code=000010"
        response = self.client.get(getValidByCode_url, name="首页配置", headers=headers)
        # print(("Response status code:", response.status_code))
        # print("Response content:", response.json())  # 返回Json，可以作为字典处理


if __name__ == '__main__':
    webbrowser.open_new_tab('http://localhost:8089')
    os.system("locust -f Stress_testing.py --host=https://testh.drplant.com.cn/business ")
